package com.tshopping.dao;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;

@Repository
public interface PictureDao {

    @Insert("insert into goods_pictures (goods,picture) values(#{goods},#{picture})")
    boolean insertGoodsPictures(@Param("goods") int goods, @Param("picture") String picture);

    @Delete("delete from goods_pictures where id=#{id}")
    boolean deletePictureByPictureId(@Param("id") int id);

    @Update("update goods_pictures set picture=#{picture} where id=#{id}")
    boolean updatePictureById(@Param("picture") String picture,@Param("id") int id);

    @Select("select picture from goods_pictures where goods=#{goods}")
    ArrayList<String> selectPicturesByGoods(int goods);

    @Delete("delete from goods_pictures where goods=#{goods}")
    boolean deletePicturesByGoodsId(@Param("goods")int goods);

    @Insert("insert into comment_pictures(comment,picture) value(#{comment},#{picture})")
    boolean insertIntoCommentPictures(@Param("comment")int comment,@Param("picture")String picture);

    @Select("select picture from comment_pictures where comment=#{comment}")
    ArrayList<String> selectCommentPictures(@Param("comment")int comment);
}
